<?php 
class Restore extends Controller {

	function index() {
		echo 'use \'restore/documents\' to insert default documents';
	}
	
	function documents() {
		$userTable = Doctrine_Core::getTable('User');
		$users = $userTable->findAll();
				
		$document = new Document();
		$document->title = 'Towards Dataset Dynamics : Change Frequency of Linked Open Data Sources';
		$document->authors = 'Hausenblas, Michael\nHogan, Aidan\nPolleres, Axel\nDecker, Stefan';
		$document->documentType = DOCUMENTTYPE_THESIS;
		//$document->created_by = $user->uid;
		//$document->updated_by = $user->uid;
		$document->thesis = new Thesis();
		$document->thesis->tutors = 'Guido Cecilio';
		$document->thesis->faculty = 'Ingenieria';
		$document->createdBy = $users[1];
		$document->updatedBy = $users[1];
		
		$file1 = new File();
		$file1->name = 'dynamic_ldow2010.pdf';
		
		$file2 = new File();
		$file2->name = 'dynamic_ldow2010.doc';
		
		$document->files[] = $file1;
		$document->files[] = $file2;
		
		$url = new Url();
		$url->url = 'www.deri.ie/hello_there.html';
		$document->urls[]= $url;
		
		//print_r($document->toArray(true));
		//print_r($file1->toArray(true));
		
		$document2 = new Document();
		$document2->title = 'Entity Categorization Over Large Document Collections';
		$document2->authors = 'Ganti, Venkatesh';
		$document2->abstract = 'Extracting entities (such as people, movies) from documents and identi- fying the categories (such as painter, writer) they belong to enable struc- tured querying and data analysis over unstructured document collections. In this paper, we focus on the problem of categorizing extracted entities. Most prior approaches developed for this task only analyzed the local doc- ument context within which entities occur. In this paper, we significantly improve the accuracy of entity categorization by (i) considering an entity’s context across multiple documents containing it, and (ii) exploiting existing large lists of related entities (e.g., lists of actors, directors, books). These approaches introduce computational challenges because (a) the context of entities has to be aggregated across several documents and (b) the lists of related entities may be very large. We develop techniques to address these challenges. We present a thorough experimental study on real data sets that demonstrates the increase in accuracy and the scalability of our approaches.';
		$document2->pages = '274-282';
		$document2->year = '2008';
		//$document->created_by = $user->uid;
		//$document->updated_by = $user->uid;
		$document2->documentType = DOCUMENTTYPE_THESIS;
		$document2->thesis = new Thesis();
		$document2->thesis->tutors = 'Yaima Acosta';
		$document2->thesis->faculty = 'Ingenieria';
		$document2->createdBy = $users[1];
		$document2->updatedBy = $users[1];
		
		$file3 = new File();
		$file3->name = 'kdd08-p274-ganti.pdf';
		
		$document2->files[] = $file3;
		
		$document3 = new Document();
		$document3->title = 'Semantic Web Interfaces for Newspaper Multimedia Content Management';
		$document3->authors = 'Perdrix, Ferran\nGarcía, Roberto\nGil, Rosa\nOliva, Marta\nA, José';
		$document3->abstract = 'The S5T project explores the possibilities of a semantic content man- agement system in the context of a mass media group (radio, TV, newspaper and internet). The system is based on Semantic Web technologies and attempts to build up a media repository that makes the media house more productive. To carry out such a challenge, the project features a user interface that takes profit from all the modelling and annotation effort, which is carried out during ontology con- struction and semantic annotation of audio transcriptions. In particular, three inter- faces have been developed whose goal is to facilitate the main interaction modes, search and browsing. For the former, a query-by-example tool has been created. For the latter, there are two specialised interfaces, which allow browsing media contents and the semantic annotations for transcriptions. These interfaces make it possible to take profit from the underlying ontologies during user interaction.';
		$document3->pages = '274-282';
		$document3->year = '2008';
		//$document->created_by = $user->uid;
		//$document->updated_by = $user->uid;
		$document3->documentType =  DOCUMENTTYPE_MASTER_THESIS;
		$document3->masterThesis = new MasterThesis();
		$document3->masterThesis->tutors = 'Guido Cecilio Garcia';
		$document3->masterThesis->faculty = 'Computer Science';
		$document3->createdBy = $users[1];
		$document3->updatedBy = $users[1];
		
		$file4 = new File();
		$file4->name = 'fprgrgmojam-hci_springer09.pdf';
		
		$document3->files[] = $file4;
		
		$conn = Doctrine_Manager::connection();
		$conn->flush();
		
		echo "Success!";
  }
	    
  function extraDocuments() {
  	$userTable = Doctrine_Core::getTable('User');
		$users = $userTable->findAll();
		
	  for( $i = 0; $i < 50; $i++  ) {
	    $document = new Document();
			$document->title = 'Document '.$i.' Title';
			$document->authors = 'Ganti, Venkatesh at '.$i;
			$document->abstract = 'Extracting entities (such as people, movies) from documents and identi- fying the categories (such as painter, writer) they belong to enable struc- tured querying and data analysis over unstructured document collections. In this paper, we focus on the problem of categorizing extracted entities. Most prior approaches developed for this task only analyzed the local doc- ument context within which entities occur. In this paper, we significantly improve the accuracy of entity categorization by (i) considering an entity’s context across multiple documents containing it, and (ii) exploiting existing large lists of related entities (e.g., lists of actors, directors, books). These approaches introduce computational challenges because (a) the context of entities has to be aggregated across several documents and (b) the lists of related entities may be very large. We develop techniques to address these challenges. We present a thorough experimental study on real data sets that demonstrates the increase in accuracy and the scalability of our approaches.';
			$document->pages = '274-282';
			$document->year = '2008';
			$document->documentType = 1;	
			$document->createdBy = $users[1];
			$document->updatedBy = $users[1];
			
			$document->save();
	  }
	  echo 'Documemnts created successful';
	}
}
